import { ConfigProvider, message, Modal } from 'antd'
import locale from 'antd/locale/zh_CN'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import './App.css'
import { RouterProvider } from 'react-router'
import { router } from './router'
import { useEffect } from 'react'

dayjs.locale('zh-cn')
function App() {
  const [modal, contextModalHolder] = Modal.useModal();
  const [api, contextHolder] = message.useMessage()
  useEffect(() => {
    window._antdMessage = api
  }, [api])
  useEffect(() => {
    window._antdModal = modal
  }, [modal])
  return (
    <ConfigProvider locale={locale}>
      {contextHolder}
      {contextModalHolder}
      <RouterProvider router={router} />
    </ConfigProvider>
  )
}

export default App
